import {SET_BUCKET_DOMAIN, SET_BUCKET_DOMAIN_TOKEN,SET_DISTRICT_LIST } from './actionTypes';
import { qiniuInfo,provinceAndCity } from '@/api/common'

export const getUrlAndTokenOfImageUpload = async ({ commit }) => {
  const response = await qiniuInfo()
  commit(SET_BUCKET_DOMAIN, response.data.result.BucketDomain)
  commit(SET_BUCKET_DOMAIN_TOKEN, response.data.result.token)
}

//省份和城市分布
export const getDistrictList = async ({ commit }) => {
	let postData = {type:1};
	const response = await provinceAndCity(postData);
	if(response.status == "200"){
        if(response.data && response.data.result){
            commit(SET_DISTRICT_LIST, response.data.result);
        }  
	}
}